package com.wfs.suanfa.nio.demo;

import java.io.FileNotFoundException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;

/**
 * @author: wfs
 * @Date: 2020/4/20 14:57
 * @Description:
 */
public class TransferFromTest {
    public static void main(String[] args) {
        try {
            RandomAccessFile aFill=new RandomAccessFile("a.txt","rw");
            FileChannel aFillChannel = aFill.getChannel();
            RandomAccessFile bFill=new RandomAccessFile("b.txt","rw");
            FileChannel bFillChannel = bFill.getChannel();
            bFillChannel.transferFrom(aFillChannel,0L,aFillChannel.size());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
